<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-2"></span><span class="hs-comment">-- |</span><span>
</span><span id="line-3"></span><span class="hs-comment">-- Module      :  GHC.GHCi.Helpers</span><span>
</span><span id="line-4"></span><span class="hs-comment">-- Copyright   :  (c) The GHC Developers</span><span>
</span><span id="line-5"></span><span class="hs-comment">-- License     :  see libraries/base/LICENSE</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- Maintainer  :  cvs-ghc@haskell.org</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- Stability   :  internal</span><span>
</span><span id="line-9"></span><span class="hs-comment">-- Portability :  non-portable (GHC Extensions)</span><span>
</span><span id="line-10"></span><span class="hs-comment">--</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- Various helpers used by the GHCi shell.</span><span>
</span><span id="line-12"></span><span class="hs-comment">--</span><span>
</span><span id="line-13"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.GHCi.Helpers</span><span>
</span><span id="line-16"></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.GHCi.Helpers.html#disableBuffering"><span class="hs-identifier">disableBuffering</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.GHCi.Helpers.html#flushAll"><span class="hs-identifier">flushAll</span></a></span><span>
</span><span id="line-17"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.GHCi.Helpers.html#evalWrapper"><span class="hs-identifier">evalWrapper</span></a></span><span>
</span><span id="line-18"></span><span>  </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-19"></span><span>
</span><span id="line-20"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.IO.html"><span class="hs-identifier">System.IO</span></a></span><span>
</span><span id="line-21"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="System.Environment.html"><span class="hs-identifier">System.Environment</span></a></span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="annot"><a href="GHC.GHCi.Helpers.html#disableBuffering"><span class="hs-identifier hs-type">disableBuffering</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-24"></span><span id="disableBuffering"><span class="annot"><span class="annottext">disableBuffering :: IO ()
</span><a href="GHC.GHCi.Helpers.html#disableBuffering"><span class="hs-identifier hs-var hs-var">disableBuffering</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-25"></span><span>  </span><span class="annot"><span class="annottext">Handle -&gt; BufferMode -&gt; IO ()
</span><a href="GHC.IO.Handle.html#hSetBuffering"><span class="hs-identifier hs-var">hSetBuffering</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="GHC.IO.StdHandles.html#stdin"><span class="hs-identifier hs-var">stdin</span></a></span><span> </span><span class="annot"><span class="annottext">BufferMode
</span><a href="GHC.IO.Handle.Types.html#NoBuffering"><span class="hs-identifier hs-var">NoBuffering</span></a></span><span>
</span><span id="line-26"></span><span>  </span><span class="annot"><span class="annottext">Handle -&gt; BufferMode -&gt; IO ()
</span><a href="GHC.IO.Handle.html#hSetBuffering"><span class="hs-identifier hs-var">hSetBuffering</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="GHC.IO.StdHandles.html#stdout"><span class="hs-identifier hs-var">stdout</span></a></span><span> </span><span class="annot"><span class="annottext">BufferMode
</span><a href="GHC.IO.Handle.Types.html#NoBuffering"><span class="hs-identifier hs-var">NoBuffering</span></a></span><span>
</span><span id="line-27"></span><span>  </span><span class="annot"><span class="annottext">Handle -&gt; BufferMode -&gt; IO ()
</span><a href="GHC.IO.Handle.html#hSetBuffering"><span class="hs-identifier hs-var">hSetBuffering</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="GHC.IO.StdHandles.html#stderr"><span class="hs-identifier hs-var">stderr</span></a></span><span> </span><span class="annot"><span class="annottext">BufferMode
</span><a href="GHC.IO.Handle.Types.html#NoBuffering"><span class="hs-identifier hs-var">NoBuffering</span></a></span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span class="annot"><a href="GHC.GHCi.Helpers.html#flushAll"><span class="hs-identifier hs-type">flushAll</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span id="flushAll"><span class="annot"><span class="annottext">flushAll :: IO ()
</span><a href="GHC.GHCi.Helpers.html#flushAll"><span class="hs-identifier hs-var hs-var">flushAll</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-31"></span><span>  </span><span class="annot"><span class="annottext">Handle -&gt; IO ()
</span><a href="GHC.IO.Handle.html#hFlush"><span class="hs-identifier hs-var">hFlush</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="GHC.IO.StdHandles.html#stdout"><span class="hs-identifier hs-var">stdout</span></a></span><span>
</span><span id="line-32"></span><span>  </span><span class="annot"><span class="annottext">Handle -&gt; IO ()
</span><a href="GHC.IO.Handle.html#hFlush"><span class="hs-identifier hs-var">hFlush</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="GHC.IO.StdHandles.html#stderr"><span class="hs-identifier hs-var">stderr</span></a></span><span>
</span><span id="line-33"></span><span>
</span><span id="line-34"></span><span id="local-6989586621679565291"><span class="annot"><a href="GHC.GHCi.Helpers.html#evalWrapper"><span class="hs-identifier hs-type">evalWrapper</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679565291"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621679565291"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-35"></span><span id="evalWrapper"><span class="annot"><span class="annottext">evalWrapper :: forall a. String -&gt; [String] -&gt; IO a -&gt; IO a
</span><a href="GHC.GHCi.Helpers.html#evalWrapper"><span class="hs-identifier hs-var hs-var">evalWrapper</span></a></span></span><span> </span><span id="local-6989586621679565274"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679565274"><span class="hs-identifier hs-var">progName</span></a></span></span><span> </span><span id="local-6989586621679565273"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679565273"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span id="local-6989586621679565272"><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621679565272"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-36"></span><span>  </span><span class="annot"><span class="annottext">String -&gt; IO a -&gt; IO a
forall a. String -&gt; IO a -&gt; IO a
</span><a href="System.Environment.html#withProgName"><span class="hs-identifier hs-var">withProgName</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621679565274"><span class="hs-identifier hs-var">progName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[String] -&gt; IO a -&gt; IO a
forall a. [String] -&gt; IO a -&gt; IO a
</span><a href="System.Environment.html#withArgs"><span class="hs-identifier hs-var">withArgs</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621679565273"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">IO a
</span><a href="#local-6989586621679565272"><span class="hs-identifier hs-var">m</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-37"></span></pre></body></html>